<?php
/**
 * @version		2.0.1 | $Id: default.php 97 2009-08-29 14:07:13Z mwi.nor $
 */

// no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm">
<div id="editcell">
    <table class="adminlist">
    <thead>
        <tr>
            <th width="10" align="center">
                <?php echo JText::_( 'MD_MATCH_EVENT' ); ?>
			</th>
            <th width="10" align="center">
                <?php echo JText::_( 'MD_MATCH_SEASON' ); ?>
			</th>
            <th width="10" align="center">
                <?php echo JText::_( 'MD_MATCH_VENUE' ); ?>
			</th>
            <th width="10" align="center">
                <?php echo JText::_( 'MD_MATCH_DATE' ); ?>
			</th>
		</tr>
	</thead>
		<tr>
			<td align="center">
				<?php echo $this->eventselect ?>
			</td>
			<td align="center">
				<?php echo $this->seasonselect ?>
			</td>
			<td align="center">
				<?php echo $this->venueselect ?>
			</td>
			<td align="center">
				<?php echo $this->dateselect ?>
			</td>
		</tr>
	</table>

    <table class="adminlist">
    <thead>
        <tr>
            <th width="10" align="center">
    			<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
			</th>
			<th width="20" align="center">
                TEMP AUSWAHL
            </th>
			<th width="20" align="center">
                <?php echo JText::_( 'MD_MATCH_DATE' ); ?>
            </th>
			<th width="20" align="center">
                <?php echo JText::_( 'MD_MATCH_VENUE' ); ?>
            </th>
			<th width="10" align="center">
                <?php echo JText::_( 'MD_MATCH_CONTESTANTS' ); ?>
            </th>
			<th width="10" align="center">
                <?php echo JText::_( 'MD_MATCH_SCORE' ); ?>
            </th>
			<th width="10" align="center">
                <?php echo JText::_( 'MD_MATCH_RESULT' ); ?>
            </th>
			<th width="20" align="center">
                <?php echo JText::_( 'MD_MATCH_HOMESTATS' ); ?>
            </th>
			<th width="20" align="center">
                <?php echo JText::_( 'MD_MATCH_AWAYSTATS' ); ?>
            </th>
			<th width="20" align="center">
                <?php echo JText::_( 'MD_MATCH_CREATED' ); ?>
            </th>
        </tr>            
    </thead>
    <?php
    $imgpath = 'components/com_matchdart/images/';
    $k = 0;
    for ($i=0, $n=count( $this->items ); $i < $n; $i++)
    {
        $row =& $this->items[$i];
        $checked    = JHTML::_( 'grid.id', $i, $row->MatchID );
        $link = JRoute::_( 'index.php?option=com_matchdart&controller=matches&task=edit&cid[]='. $row->MatchID );
    ?>
        <tr class="<?php echo "row$k"; ?>">
            <td align="center">
  				  <?php echo $checked; ?>
			</td>
            <td align="center">
            	MatchEventID: <?php echo $row->MatchEventID; ?><br />
            	MatchSeasonID: <?php echo $row->MatchSeasonID; ?><br />
            	EventUseTeams: <?php echo $row->EventUseTeams; ?><br />
            	EventUseSets: <?php echo $row->EventUseSets; ?><br />
            	MatchUseXStats: <?php echo $row->MatchUseXStats; ?><br />
            </td>
            <td align="center">
            	<?php echo $row->MatchDate; ?>
            </td>
            <td align="center">
            	<?php echo $row->MatchVenueName; ?>
            </td>
            <td align="center">
               	<?php 
            		if ($row->EventUseTeams == 1) {
            			echo $row->MatchHomeTeamName.' - '.$row->MatchAwayTeamName.'<br />';
            		}
            	?>
            	<a href="<?php echo $link ?>"><?php echo $row->MatchHomePlayerName; ?> - <?php echo $row->MatchAwayPlayerName; ?></a>
            </td>
            <td align="center">
            	<?php 
            		if ($row->EventUseSets == 1) {
            			echo $row->MatchHomeSets.' - '.$row->MatchAwaySets.'<br />';
            		}
            	?>
            	<?php echo $row->MatchHomeLegs; ?> - <?php echo $row->MatchAwayLegs; ?>
            </td>
            <td align="center">
            	<?php echo $row->MatchResult; ?>
            </td>
            <td align="center">
            	<?php echo JText::_( 'MD_MATCH_HOME_BONUS' ).': '.$row->MatchHomeBonus; ?><br />
            	<?php echo JText::_( 'MD_MATCH_HOME_LWAT' ).': '.$row->MatchHomeLWAT; ?><br />
            	<?php echo JText::_( 'MD_MATCH_HOME_HC' ).': '.$row->MatchHomeHC; ?><br />
            	<?php echo JText::_( 'MD_MATCH_HOME_180' ).': '.$row->MatchHome180; ?><br />
            	<?php echo JText::_( 'MD_MATCH_HOME_140' ).': '.$row->MatchHome140; ?><br />
            	<?php echo JText::_( 'MD_MATCH_HOME_100' ).': '.$row->MatchHome100; ?><br />
            	<?php echo JText::_( 'MD_MATCH_HOME_AVG3' ).': '.$row->MatchHomeAVG3; ?><br />
            	<?php echo JText::_( 'MD_MATCH_HOME_AVG1' ).': '.$row->MatchHomeAVG1; ?><br />
            </td>
            <td align="center">
            	<?php echo JText::_( 'MD_MATCH_AWAY_BONUS' ).': '.$row->MatchAwayBonus; ?><br />
            	<?php echo JText::_( 'MD_MATCH_AWAY_LWAT' ).': '.$row->MatchAwayLWAT; ?><br />
            	<?php echo JText::_( 'MD_MATCH_AWAY_HC' ).': '.$row->MatchAwayHC; ?><br />
            	<?php echo JText::_( 'MD_MATCH_AWAY_180' ).': '.$row->MatchAway180; ?><br />
            	<?php echo JText::_( 'MD_MATCH_AWAY_140' ).': '.$row->MatchAway140; ?><br />
            	<?php echo JText::_( 'MD_MATCH_AWAY_100' ).': '.$row->MatchAway100; ?><br />
            	<?php echo JText::_( 'MD_MATCH_AWAY_AVG3' ).': '.$row->MatchAwayAVG3; ?><br />
            	<?php echo JText::_( 'MD_MATCH_AWAY_AVG1' ).': '.$row->MatchAwayAVG1; ?><br />
            </td>
            <td align="center">
            	<?php echo Date($this->dateformat, $row->MatchCreated); ?>
            </td>
        </tr>
        <?php
        $k = 1 - $k;
    }
    ?>
    <tfoot>
		<tr>
			<td colspan="17">
				<?php echo $this->pagination->getListFooter(); ?>
			</td>
		</tr>
	</tfoot>
    </table>
</div>

<input type="hidden" name="option" value="com_matchdart" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="controller" value="matches" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>